<?php
if (!defined("BASEPATH")) exit("No direct script access allowed");

class Group extends MY_Model {

	function __construct() {
		parent::__construct();
		$this->tableName = "group";
		$this->prefix = "grp";
	}

	function getGroup($where = NULL) {
		$qs =	"
					select
						grp_id, grp_name
					from
						".$this->db->dbprefix.$this->tableName."
					where
						grp_del = 0 ".((Common::isSuperAdmin())?(""):(" and grp_id = 2 "))." ".((is_null($where))?(""):(" and ".$where))."
					order by
						grp_name
					";
		$result = $this->db->query($qs);
		$getGroup = array();
			foreach ($result->result() as $row) {
				$getGroup[] = array(
					"grpId" => $row->grp_id,
					"grpName" => $row->grp_name,
				);
			}
		return $getGroup;
	}

}